package 华为;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author zhangmin
 * @create 2022-08-31 18:55
 */
public class HuaWei_0831_1 {
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        String[] line=cin.nextLine().split(" ");
        String[] list=cin.nextLine().split(" ");
        Map<String, Integer> map=new HashMap<>();
        for (int i=0;i<list.length;i++) {
            String l=list[i];
            map.put(l.toLowerCase(),i);
        }
        for (HashMap.Entry entry:map.entrySet()) {
            System.out.println(entry.getKey()+"-"+entry.getValue());
        }
        StringBuffer res=new StringBuffer();
        boolean inKuohao = false;
        for (String ls:line) {
            System.out.println("ls="+ls);
            if (ls.length()==0) {
                res.append(" ");
                continue;
            }
            if (ls.charAt(0)=='"'&&!inKuohao){
                res.append(ls).append(" ");
                inKuohao=true;
            }else if(ls.charAt(0)=='"'&&inKuohao){
                res.append(ls).append(" ");
                inKuohao=false;
            }else {
                if (inKuohao){
                    res.append(ls).append(" ");
                }else {
                    String cur=map.containsKey(ls.toLowerCase())? String.valueOf(map.get(ls.toLowerCase())) :ls;
                    res.append(cur).append(" ");
                }
            }
        }
        System.out.println(res.toString());
    }
}
